﻿using System;

namespace Pogo.Data
{
   public class PogoExceptionData
   {
      public InnerExceptionData HbException { get; set; }

      public string Message
      {
         get
         {
            switch (HbException.ECode)
            {
               case 0:
                  return HbException.Message;
               case 400:
                  return HbException.Message + " (Unspecified client error)";
               case 500:
                  return HbException.Message + " (Unspecified server error)";
               case 600:
                  return HbException.Message + " (Invalid argument format or missing required argument)";
               case 601:
                  return HbException.Message + " (Index into list out of range (e.g. page offset))";
               case 602:
                  return HbException.Message + " (The request cannot be fullfilled because it is not implemented)";
               case 606:
                  return HbException.Message + " (The valtoken is not valid or has expired)";
               case 800:
                  return HbException.Message + " (User does not exist)";
               case 801:
                  return HbException.Message + " (The referenced device does not exist)";
               case 802:
                  return HbException.Message + " (The referenced service does not exist)";
               case 803:
                  return HbException.Message + " (The referenced space does not exist)";
               case 804:
                  return HbException.Message + " (The referenced file does not exist)";
               case 805:
                  return HbException.Message +
                         " (The user represented by that valtoken does not have permission to do this)";
               case 806:
                  return HbException.Message + " (Generic unavailable error response)";
               default:
                  return HbException.Message + " (Unknown error code)";
            }
         }
      }
   }

   public class InnerExceptionData
   {
      public string Message { get; set; }
      public int ECode { get; set; }
   }

   public class PogoException : ApplicationException
   {
      public PogoException(string message) : base(message)
      {
      }
   }
}